package com.example.composemodifiterdemo

import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.compose.foundation.Image
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.*
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material.Card
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.BlurredEdgeTreatment
import androidx.compose.ui.draw.blur
import androidx.compose.ui.draw.clip
import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp


/**
 * @auth: njb
 * @date: 2023/1/9 20:58
 * @desc:
 */
class ComposeBaseWeightActivity: ComponentActivity() {

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContent {
            ArtistCard()
        }
    }

    @Preview
    @Composable
    fun ArtistCard() {
        Row(verticalAlignment = Alignment.CenterVertically) {
            Image(painter = painterResource(id = R.mipmap.avatar), contentDescription = stringResource(
                id = R.string.dog_content_description),
                contentScale = ContentScale.Crop,
                modifier = Modifier
                    .size(50.dp)
                    .blur(
                        radiusX = 10.dp,
                        radiusY = 10.dp,
                        edgeTreatment = BlurredEdgeTreatment.Unbounded
                    )
                    .clip(RoundedCornerShape(8.dp)))
            Spacer(modifier = Modifier.width(20.dp))
            Column {
                Text("Alfred Sisley")
                Text("3 minutes ago")
            }
        }
    }

/*    @Composable
    fun ArtistCard(
        onClick: () -> Unit
    ) {
        val padding = 16.dp
        Column(
            Modifier
                .clickable(onClick = onClick)
                .padding(padding)
                .fillMaxWidth()
        ) {
            Row(verticalAlignment = Alignment.CenterVertically) { *//*...*//* }
            Spacer(Modifier.size(padding))
            Card(elevation = 4.dp) { *//*...*//* }
        }
    }*/
}